package com.example.pageexample.page;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import androidx.paging.DataSource;

import com.example.pageexample.database.Picture;

/**
 * 创建DataSource实现对象,并且包装之后暴露给ViewModel
 * @author mailangdeguozhe
 * @date 20220709
 */
public class PageSourceFactory extends DataSource.Factory<Integer , Picture> {
    private MutableLiveData<PageSource> mPictureLiveData = new MutableLiveData<>();

    @NonNull
    @Override
    public DataSource<Integer, Picture> create() {
        PageSource pageSource = new PageSource();
        mPictureLiveData.postValue(pageSource);
        return pageSource;
    }
}
